package site.qjdb.pojo.response;

/**
 * 	服务器统一返回前端数据格式模板
 * 
 * */
public class CommonResult<T> {
	private int code;
	private String message;
	private T data;

	public CommonResult() {
		super();
	}

	public CommonResult(int code) {
		super();
		this.code = code;
	}

	public CommonResult(ResponseCode responseCode) {
		this.code = responseCode.getCode();
		this.message = responseCode.getMessage();
	}

	public CommonResult(ResponseCode responseCode, String message) {
		this.code = responseCode.getCode();
		this.message = message;
	}
	/**
	 * 	如果data类型为String，不要用这个方法，用CommonResult(responseCode, message, data)这个方法
	 * 
	 * */
	public CommonResult(ResponseCode responseCode, T data) {
		this.code = responseCode.getCode();
		this.message = responseCode.getMessage();
		this.data = data;
	}
	public CommonResult(ResponseCode responseCode, String message, T data) {
		this.code = responseCode.getCode();
		this.message = message;
		this.data = data;
	}
	

	public CommonResult(int code, String message) {
		super();
		this.code = code;
		this.message = message;
	}

	public CommonResult(int code, String message, T data) {
		super();
		this.code = code;
		this.message = message;
		this.data = data;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public T getData() {
		return data;
	}

	public void setData(T data) {
		this.data = data;
	}

}
